package com.tbit.uqbike.service.business.impl;

import com.tbit.uqbike.object.pojo.LessIntelligentSite;
import com.tbit.uqbike.service.business.LessIntelligentSiteService;
import com.tbit.uqbike.webmanager.dao.core.LessIntelligentSiteDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author ：hzw
 * @date ：Created in 2021/8/30 16:46
 * @description：冷门站点推荐业务层
 * @modified By：
 * @version: $
 */
@Service(value = "lessIntelligentSiteService")
public class LessIntelligentSiteServiceImpl implements LessIntelligentSiteService {
    @Autowired
    private LessIntelligentSiteDao lessIntelligentSiteDao;

    @Override
    public List<LessIntelligentSite> queryPage(Long startTime, Long endTime, Integer state, List<Integer> regionIdList, Integer pageNO, Integer rowCount, Integer accountId) {
        Map<String, Object> map = new HashMap<>();
        if (null != startTime && null != endTime) {
            map.put("startTime", new Date(startTime));
            map.put("endTime", new Date(endTime));
        }
        map.put("state", state);
        map.put("regionIdList", regionIdList);
        map.put("pageNO", (pageNO - 1) * rowCount);
        map.put("rowCount", rowCount);
        map.put("accountId", accountId);
        return lessIntelligentSiteDao.queryPage(map);
    }

    @Override
    public Integer queryCount(Long startTime, Long endTime, Integer state, List<Integer> regionIdList, Integer accountId) {
        Map<String, Object> map = new HashMap<>();
        if (null != startTime && null != endTime) {
            map.put("startTime", new Date(startTime));
            map.put("endTime", new Date(endTime));
        }
        map.put("state", state);
        map.put("regionIdList", regionIdList);
        map.put("accountId", accountId);
        return lessIntelligentSiteDao.queryCount(map);
    }

    @Override
    public void handle(LessIntelligentSite lessIntelligentSite) {
        lessIntelligentSiteDao.handle(lessIntelligentSite);
    }

    @Override
    public LessIntelligentSite getLotIntelligentSite(Integer siteId) {
        return lessIntelligentSiteDao.getDataById(siteId);
    }
}
